package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.http.ApiService;
import xhwl.hmo.mall.utils.SpUtil;
import xhwl.retrofitrx.BaseApi;

/**
 * 获取商品详情页面
 */

public class GetGoodsDetailApi extends BaseApi {
    GetGoodsDetailReq req;
    public GetGoodsDetailApi(String goods_id){
        req=new GetGoodsDetailReq(goods_id);
        setShowDialog(true);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).getGoodsDetail(requestBody);
    }
    public static class GetGoodsDetailReq {

        /**
         * member_mobile : 13292786298
         * goods_id : 6548520
         */

        private String member_mobile;
        private String goods_id;

        public GetGoodsDetailReq(String goods_id) {
            this.member_mobile = SpUtil.getString(SpUtil.MEMBER_MOBILE,"");
            this.goods_id = goods_id;
        }
    }
}
